package com.woniuxy.provider;

import com.woniuxy.entity.Region;
import org.apache.ibatis.jdbc.SQL;

public class RegionProvider {
    public String selectAll(Region region){
        return new SQL(){{
            SELECT("*");
            FROM("gfr_region");
            if(region.getParentId() != null){
                WHERE("parentId='"+region.getParentId() + "'");
            }
            if (region.getParentId()== null){
                WHERE("parentId"+" "+"is"+" "+null);
            }
        }}.toString();
    }
}
